<template>
    <h2>我是About的内容</h2>
</template>

<script>
    export default {
        name:'About',
        beforeDestroy(){
            console.log('About组件即将销毁')
        },
        
        beforeRouteEnter (to, from, next) {
            // 通过路由规则进入时
            if(to.meta.isAuth){
                if(localStorage.getItem('school') === 'zd') {
                    next() // 放行
                } else{
                    alert('没有权限')
                }
                
            } else{
                next() // 放行
            }
        },
        beforeRouteLeave (to, from, next) {
            // 离开时调用
            next()
        }
    }
</script>

<style>

</style>